package windows;

import java.awt.Dimension;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
import javax.swing.JSpinner;
import javax.swing.JTextArea;

public class ManageInsumosCreate extends JPanel implements ActionListener
{
	/**
	 *
	 */
	private static final long serialVersionUID = 1L;
	private JButton ok;





	private JLabel TextNameInsumo;
	private JLabel TextCodInsumo;
	private JLabel TextEgg;
	private JLabel TextFlour;
	private JLabel TextSugar;
	private JLabel TextMilk;
	private JLabel TextColoring;
	private JLabel TextSabor;
	private JLabel TextStraberry;
	private JLabel TextRaisin;

	private JTextArea AreaNameInsumo;
	private JTextArea AreaCodInsumo;
	
	private JRadioButton RButtonEgg;
	private JRadioButton RButtonFlour;
	private JRadioButton RButtonSugar;
	private JRadioButton RButtonMilk;
	private JRadioButton RButtonColoring;
	private JRadioButton RButtonSabor;
	private JRadioButton RButtonStraberry;
	private JRadioButton RButtonRaisin;

	
	private JSpinner JSPEgg;
	private JSpinner JSPFlour;
	private JSpinner JSPSugar;
	private JSpinner JSPMilk;
	private JSpinner JSPColoring;
	private JSpinner JSPSabor;
	private JSpinner JSPstraberry;
	private JSpinner JSPRaisin;


	
	public ManageInsumosCreate()
	{
		// TODO Auto-generated constructor stub

		setLayout(null);


		RButtonFlour=new JRadioButton();
		RButtonFlour.setBounds(230,85, 30, 20);
		RButtonFlour.addActionListener(this);
		add(RButtonFlour);
		
		RButtonSugar=new JRadioButton();
		RButtonSugar.setBounds(230,120, 30, 20);
		RButtonSugar.addActionListener(this);
		add(RButtonSugar);

		RButtonEgg=new JRadioButton();
		RButtonEgg.setBounds(230,155, 30, 20);
		RButtonEgg.addActionListener(this);
		add(RButtonEgg);

		RButtonSabor=new JRadioButton();
		RButtonSabor.setBounds(230,190, 30, 20);
		RButtonSabor.addActionListener(this);
		add(RButtonSabor);

		RButtonMilk=new JRadioButton();
		RButtonMilk.setBounds(230,225, 30, 20);
		RButtonMilk.addActionListener(this);
		add(RButtonMilk);
		
		RButtonColoring=new JRadioButton();
		RButtonColoring.setBounds(230,260, 30, 20);
		RButtonColoring.addActionListener(this);
		add(RButtonColoring);
				
		RButtonStraberry=new JRadioButton();
		RButtonStraberry.setBounds(230,295, 30, 20);
		RButtonStraberry.addActionListener(this);
		add(RButtonStraberry);
		
		RButtonRaisin=new JRadioButton();
		RButtonRaisin.setBounds(230,330, 30, 20);
		RButtonRaisin.addActionListener(this);
		add(RButtonRaisin);
		
		
		
		/***************************JButton**************************************/
		ok = new JButton("Guardar");
		ok.setBounds(170,400, 100, 20);
		ok.addActionListener(this);
		add(ok);


		/*********************************JSpinner***********************************************/


		JSPFlour=new JSpinner();
		JSPFlour.setBounds(300, 85, 40, 25);
		JSPFlour.setEnabled(false);
		add(JSPFlour);

		JSPSugar=new JSpinner();
		JSPSugar.setBounds(300, 120, 40, 25);
		JSPSugar.setEnabled(false);
		add(JSPSugar);

		JSPEgg=new JSpinner();
		JSPEgg.setBounds(300, 155, 40, 25);
		JSPEgg.setEnabled(false);
		add(JSPEgg);

		JSPSabor=new JSpinner();
		JSPSabor.setBounds(300,190, 40, 25);
		JSPSabor.setEnabled(false);
		add(JSPSabor);
		
		JSPMilk=new JSpinner();
		JSPMilk.setBounds(300, 225, 40, 25);
		JSPMilk.setEnabled(false);
		add(JSPMilk);

		JSPColoring=new JSpinner();
		JSPColoring.setBounds(300, 260, 40, 25);
		JSPColoring.setEnabled(false);
		add(JSPColoring);

		
		JSPstraberry=new JSpinner();
		JSPstraberry.setBounds(300, 295, 40, 25);
		JSPstraberry.setEnabled(false);
		add(JSPstraberry);

		JSPRaisin=new JSpinner();
		JSPRaisin.setBounds(300, 330, 40, 25);
		JSPRaisin.setEnabled(false);
		add(JSPRaisin);



	    /******************************JLabel**********************************/

		TextCodInsumo=new JLabel("Codigo:");
		TextCodInsumo.setBounds(50, 15, 150, 25);
		add(TextCodInsumo);		
		
		TextNameInsumo = new JLabel("Nombre Lista:");
		TextNameInsumo.setBounds(50, 50, 150, 25);
		add(TextNameInsumo);

		TextFlour = new JLabel("Harina:");
		TextFlour.setBounds(50, 85, 150, 25);
		add(TextFlour);

		TextSugar = new JLabel("Azucar:");
		TextSugar.setBounds(50, 120, 150, 25);
		add(TextSugar);

		TextEgg=new JLabel("Huevos");
		TextEgg.setBounds(50, 155, 150, 25);
		add(TextEgg);
		
		TextSabor=new JLabel("Saborizantes");
		TextSabor.setBounds(50, 190, 150, 25);
		add(TextSabor);
		
		TextMilk=new JLabel("Leche:");
		TextMilk.setBounds(50, 225, 150, 25);
		add(TextMilk);

		TextColoring=new JLabel("Colorantes:");
		TextColoring.setBounds(50, 260, 150, 25);
		add(TextColoring);

		TextStraberry=new JLabel("Fresas:");
		TextStraberry.setBounds(50, 295, 150, 25);
		add(TextStraberry);
		
		TextRaisin=new JLabel("Uvas Pasas:");
		TextRaisin.setBounds(50, 330, 150, 25);
		add(TextRaisin);
		
		/****************************JTextArea*************************************/
		AreaNameInsumo = new JTextArea();
		AreaNameInsumo.setBounds(200, 50, 150, 20);
		add(AreaNameInsumo);

		AreaCodInsumo = new JTextArea();
		AreaCodInsumo.setBounds(200, 15, 150, 20);
		add(AreaCodInsumo);

		
		/*******************************************************/


		Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
		setBounds((screenSize.width-664)/2, (screenSize.height-456)/2, 670, 310);
	}

	public void actionPerformed(ActionEvent e)
	{
		
		if(e.getSource()==ok)
		{

		}
		if(e.getSource()==RButtonColoring)
		{
			JSPColoring.setEnabled(true);	
		}
		if(e.getSource()==RButtonEgg)
		{
			JSPEgg.setEnabled(true);	
		}
		if(e.getSource()==RButtonFlour)
		{
		JSPFlour.setEnabled(true);	
		}
		if(e.getSource()==RButtonMilk)
		{
		JSPMilk.setEnabled(true);	
		}
		if(e.getSource()==RButtonRaisin)
		{
		JSPRaisin.setEnabled(true);	
		}
		if(e.getSource()==RButtonSabor)
		{
		JSPSabor.setEnabled(true);	
		}
		if(e.getSource()==RButtonStraberry)
		{
		JSPstraberry.setEnabled(true);	
		}
		if(e.getSource()==RButtonSugar)
		{
		JSPSugar.setEnabled(true);	
		}
	}

	public void clean() 
	{
		AreaNameInsumo.setText("");
		AreaCodInsumo.setText("");
		
		RButtonEgg.setSelected(false);
		RButtonFlour.setSelected(false);
		RButtonSugar.setSelected(false);
		RButtonMilk.setSelected(false);
		RButtonColoring.setSelected(false);
		RButtonSabor.setSelected(false);
		RButtonStraberry.setSelected(false);
		RButtonRaisin.setSelected(false);
		
		JSPEgg.setValue(0);
		JSPFlour.setValue(0);
		JSPSugar.setValue(0);
		JSPMilk.setValue(0);
		JSPColoring.setValue(0);
		JSPSabor.setValue(0);
		JSPstraberry.setValue(0);
		JSPRaisin.setValue(0);
	}

}
